﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Context;
using Entity;
using System.Runtime.Remoting;
using HR_Interfaces;
using DataObject_LinQ_;


namespace HR_Implements
{
   public class EmployeeRemotingObject:MarshalByRefObject,IEmployeeRemotingObject
    {
       Context.DB_HR ctx = new DB_HR();
       public List<EmployeeEntity> getAllEmployees()
       {
           List<EmployeeEntity> emp_get = null;
           var q = from e in ctx.Employees
                   select new EmployeeEntity()
                   {
                       CEmployeeCode = e.cEmployeeCode,
                       VFirstName = e.vFirstName,
                       VQualification = e.vQualification
                   };
           emp_get = q.ToList();
           return emp_get;
       }
       public List<EmployeeEntity> searchEmployeesByQualification(String qualification)
       {
           List<EmployeeEntity> emp_search = null;
           var q = from e in ctx.Employees
                   where e.vQualification == qualification
                   select new EmployeeEntity()
                   {
                       CEmployeeCode = e.cEmployeeCode,
                       VFirstName = e.vFirstName,
                       VQualification = e.vQualification
                   };
           emp_search = q.ToList();
           return emp_search;
       }
    }
}
